package y24.m3;

import java.util.Random;
import java.util.Scanner;

public class Test14 {
    public static void main(String[] args) {
        int num = new Random().nextInt(100);
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入一个数—>");
        while (true) {
            int guessed = scanner.nextInt();
            if (num == guessed) {
                System.out.println("恭喜你猜对了");
                return;
            } else if (num < guessed) {
                System.out.print("很抱歉，猜大了，请重新输入一个数—>");
            } else {
                System.out.print("很抱歉，猜小了，请重新输入一个数—>");
            }
        }
    }
}